/*
 *  $Id: Vampire.cs 1004 2010-05-03 11:50:53Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Affects {
    /// <summary>
    /// Эффект: вампир
    /// Исцеляет себя в объеме нанесенных повреждений по существу.
    /// </summary>
    public class Vampire: FlagAffect {
        public override string Id {
            get { return "vampire"; }
        }

        public override ElementType Element {
            get { return ElementType.Darkness; }
        }

        public override int BaseWeight {
            get { return 30; }
        }

        public override AffectIcon Icon {
            get { return AffectIcon.Vampire; }
        }

        public override void SetAffect() {
            base.SetAffect();
            LocalSummary.OnHit += DoVampire;
        }
        public override void ResetAffect() {
            base.ResetAffect();
            LocalSummary.OnHit -= DoVampire;
        }

        private void DoVampire(Creature hitter, AbstractObject target, int damage) {
            if (target is Creature) hitter.HealBy(NewDamage(DamageType.Regeneration, damage));
        }
    }
}